﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using IQKS.AWP.DataAccessLayer;
using IQKS.AWP.BusinessObject;


namespace IQKS.AWP.BusinessAccessLayer
{
    public class CountryMasterBAL
    {

        public DataSet GetCountry()
        {
            DataSet objDs;
            try
            {
                objDs = new CountryMasterDAL().GetCountry();

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        public DataSet GetCountryMaster()
        {
            DataSet objDs;
            try
            {
                objDs = new CountryMasterDAL().GetCountryMaster(0);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }
        public DataSet DS_GetCountryMaster(params object[] param)
        {
            DataSet objDs;
            try
            {
                objDs = new CountryMasterDAL().GetCountryMaster(param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        public CountryMasterBO GetCountryMaster(params object[] param)
        {
            CountryMasterBO objLMBo;
            try
            {
                objLMBo = new CountryMasterBO();
                DataSet objDs;
                objDs = new CountryMasterDAL().GetCountryMaster(param);
                if (objDs != null)
                {
                    DataTable objDt = objDs.Tables[0];
                    if (objDt != null)
                    {
                        objLMBo.CountryID = Convert.ToInt32(objDt.Rows[0]["CountryID"]);
                        //objLMBo.RegionID = Convert.ToInt32(objDt.Rows[0]["RegionID"]);
                        objLMBo.CountryName = Convert.ToString(objDt.Rows[0]["CountryName"]);
                        objLMBo.CountryTelCode = Convert.ToString(objDt.Rows[0]["CountryTelCode"]);
                        objLMBo.CountryCode =Convert.ToString(objDt.Rows[0]["CountryCode"]);
                        objLMBo.RegionID = Convert.ToInt32(objDt.Rows[0]["RegionID"]);
                        objLMBo.IsActive = Convert.ToBoolean(objDt.Rows[0]["IsActive"]);
                    }
                    else
                    {
                        objLMBo = null;
                    }
                }

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objLMBo;
        }


        public object SetCountryMaster(params object[] param)
        {
            try
            {
                return new CountryMasterDAL().SetCountryMaster(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public DataSet GetRegionBindBAL()
        {
            
            try
            {
                return new CountryMasterDAL().GetRegionBindDAL(0);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        public DataSet GetCountryLanguageByCountryID(params object[] param)
        {
            DataSet objDs;
            try
            {
                objDs = new CountryMasterDAL().GetCountryLanguageByCountryID(param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }
        public object SetCountryLangaugeMaster(params object[] param)
        {
            try
            {
                return new CountryMasterDAL().SetCountryLanguageMaster(param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

    }
}
